package pl.koziolekweb.translator.gui;

import java.awt.Color;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SpringLayout;

import pl.koziolekweb.translator.utilites.Context;

/**
 * Klasa reprezentuje panel roboczy.
 * 
 * @author koziolek
 * 
 */
public class WorkingArea extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9040565678709138071L;

	/**
	 * Kontekst applikacji.
	 */
	private Context context;

	/**
	 * Layout manager.
	 */
	private SpringLayout layout;

	/**
	 * Konstruktor wiąże panel z kontekstem aplikacji.
	 * 
	 * @param context
	 */
	public WorkingArea(Context context) {
		this.context = context;
		createWorkingAreaPanel();
		context.add("workingAreaPanel", this);
	}

	private void createWorkingAreaPanel() {
		setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
		this.setSize((int) (Integer.parseInt(context.getParam("width")) * 0.6),
				Integer.parseInt(context.getParam("height")));
		this.layout = new SpringLayout();
	}
}
